package org.linlinjava.litemall.wx.config;

import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig;
import com.github.binarywang.wxpay.config.WxPayConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WeixinConfig {
   // public static final String WX_AppId = "wx3da21a44e66aafb9";
    //public static final String WX_Secret = "937d48f1dafa63f32a55e1a60cd7ed61";
    //生产
    public static final String WX_Secret = "8de3c66dd598a6e2c59c9efb3e42af6c";
    public static final String WX_AppId = "wx95d9bb85f5baa173";
    public static final String WX_Token = "";
    public static final String WX_AesKey = "";
    public static final String WX_MsgDataFormat = "JSON";

    //商户号
    public static final String WX_MchId = "1503168671";
    public static final String WX_MchKey = "irjoQAeq9dZWixvFwJhYJkGJEhrQDYFv";
    /**
     * 开发
     */
    //public static final String WX_KeyPath = "C:\\Users\\shixi\\Desktop\\keyPath\\apiclient_cert.p12";
    //支付回调路径
    //public static final String NOTIFY_URL = "http://sxf1213.tunnel.qydev.com/wx/pay/notify";

    /**
     * 生产
     * @return
     */
    public static final String WX_KeyPath = "/usr/keyPath/apiclient_cert.p12";
    //支付回调路径
    public static final String NOTIFY_URL = "https://daoweicloud.com/shop/wx/pay/notify";
    @Bean
    public WxMaConfig wxMaConfig() {
        WxMaInMemoryConfig config = new WxMaInMemoryConfig();
        config.setAppid(WX_AppId);
        config.setSecret(WX_Secret);
        config.setToken(WX_Token);
        config.setAesKey(WX_AesKey);
        config.setMsgDataFormat(WX_MsgDataFormat);

        return config;
    }


    @Bean
    public WxPayConfig wxPayConfig() {
        WxPayConfig payConfig = new WxPayConfig();
        payConfig.setAppId(WX_AppId);
        payConfig.setMchId(WX_MchId);
        payConfig.setMchKey(WX_MchKey);
        payConfig.setSubAppId(null);
        payConfig.setSubMchId(null);
        payConfig.setKeyPath(WX_KeyPath);

        return payConfig;
    }
}